/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.manage.customers;

import java.util.List;
import main.WinkelApplication;
import model.Klant;

/**
 *
 * @author Marco
 * 
 * CustomerData keeps all data on the customers.
 */


public class CustomerData {
    private List<Klant> klanten;
    
    public CustomerData(List<Klant> klanten) {
        this.klanten = klanten;
    }
    
    public void compareRow(int row, String name, String adres, String postalCode, String home) {
        Klant klant = klanten.get(row);
        //If one attribute of the row is altered this returns true.
        boolean altered = (
                ! klant.getAdres().equals(adres) ||
                ! klant.getNaam().equals(name) ||
                ! klant.getPostcode().equals(postalCode) ||
                ! klant.getWoonplaats().equals(home));
        System.out.println(altered);
        if(altered) {
            WinkelApplication.getQueryManager().updateKlant(klant.getGebruiker_id(), name, adres, postalCode, home);
        }
    }
}
